package com.xmy.cultivate.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xmy.cultivate.entity.Grade;
import com.xmy.cultivate.entity.Student;
import com.xmy.cultivate.entity.StudentGrade;
import com.xmy.cultivate.entity.views.ResLossData;
import com.xmy.cultivate.entity.views.SelectStudent;
import org.springframework.scheduling.annotation.Async;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 学生表 服务类
 * </p>
 *
 * @author min
 * @since 2022-07-26
 */
public interface IStudentService extends IService<Student> {

    public abstract IPage<Student> findAll(IPage<?> page, Wrapper wrapper, Long schoolId);

    public abstract IPage<Student> rosterList(IPage<?> page, Integer yearPart, Integer quarterNum, Long schoolId, String schoolIdStr, String state, String isGuanzhu, String isGather, String isOwn, String isIdCard, String isCourseHouse, String isScheduling, String keywordType, String keyWord, Integer sourseLeve, Long adminId);

    /**
     * 花名册导出
     *
     * @return
     */
    public abstract IPage<Student> rosterListExcel(IPage<?> page, Integer yearPart, Integer quarterNum, Long schoolId, String schoolIdStr, String state, String isGuanzhu, String isGather, String isOwn, String isIdCard, String isCourseHouse, String isScheduling, String keywordType, String keyWord, Integer sourseLeve, Long adminId, String studentId);

    public abstract BigDecimal arrearage(Wrapper wrapper);

    public abstract IPage<Student> signUpStu(IPage<?> page, Wrapper wrapper);

    public abstract Student findOne(Long id);

    public abstract Boolean saveTo(Student student);

    public abstract boolean updateTo(Student student);

    public abstract String updatePhoneNum(String id, Student student);

    public abstract Boolean updatePhoneNumNew(String id, Student student);

    public abstract IPage<Student> getStudentForGradeId(Long gradeId, String name, Integer pageNum, Integer pageSize, String studentList, String status, String startDate, String endDate, Integer newTeacher, Long teacherId);

    IPage<SelectStudent> getStudentForShift(IPage<?> page, QueryWrapper wrapper, Grade grade, String studentName, Long classTypeId);

    IPage<SelectStudent> getAllotStudent(IPage<?> page, Wrapper wrapper, Grade grade, Integer yearAndQuarter, Integer yearPart, Integer quarterNum, Integer lessonType, Long classTypeId);

    public abstract boolean addGradeStudent(String gradeId, String[] studentList);

    String getStudentName(Long id);

    public abstract List<Student> getStudentCount(String schoolId, String subjectsId, String yearPart, String quarterNum, String courseTypeId, Integer status, String startDate, String endDate);

    public abstract Integer getStudentCountByYearClassId(String schoolId, String subjectsId, String yearPart, String quarterNum, String courseTypeId, String yearClassId, Integer status, String startDate, String endDate);

    public abstract Integer getStudentCountBySchoolId(String schoolId, String subjectsId, String yearPart, String quarterNum, String courseTypeId, Integer status, String startDate, String endDate);

    void updateStudentBatch() throws Exception;

    ResLossData getLossData(Long subjectsId,
                            Integer lessonType,
                            Long startQuarterId,
                            Long endQuarterId);

    @Async("")
    void resetYearClassId();

    public abstract IPage<StudentGrade> getStudentIdByReading(IPage<?> page, String studentName);

    Integer getTryStudentForNameCount(String name, Long schoolId);

    void  addOrUpdateData(Student student);
}
